'use strict';

module.exports = collectSameElements;
function collectSameElements(collectionA, collectionB) {
  let result=[];
  
  let m=collectionA.length;
  let n=collectionB.length;
 
  for(let i=0;i<m;i++){
    for(let j=0;j<n;j++){
      if(collectionA[i]===collectionB[j]){
        result.push(collectionA[i]);
      }
    }
  }

console.log(result);
return result;

}
collectSameElements( ['a', 'e', 'h', 't', 'f', 'c', 'g', 'b', 'd'],['a', 'd', 'e', 'f']);

